<template>
  <div>
  </div>
</template>
<script>
import { education as Api } from '../../api/education';
export default {
  data() {
    return {
      codes: {
        code: ''
      },
      personalid: ''
    };
  },
  methods: {
    init() {
      let getUrlStr = function(name) {
        var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
      };
      let sign = getUrlStr('code');
      this.codes.code = sign;
      Api.grantAuthorization.call(this, this.codes, data => {
        this.personalid = data.userId;
        // this.$router.push({ path: `/index` });
        window.location.href = '';
        // window.location.href = 'http://qdjy.ngrok.cc/edu/index.html#/index';
        // window.location.href = 'http://123.207.7.165/#/index';
      });
      // console.log(this.personalid);
    }
  },
  mounted() {
    this.init();
    // console.log(this.personalid);
  }
};
</script>

<style lang="less">

</style>
